package fileServices;

import java.io.IOException;
import java.net.UnknownHostException;
import java.util.ArrayList;

import entities.CSFileWrapper;

public class WebFileService {
	public void TransferFile(String hostIp, String targetIp, String fileName) throws UnknownHostException, IOException{//SendFile/getFile
		System.out.println("WebFileService: transferFile()");
		
		FileServiceClient fsc = new FileServiceClient();
		CSFileWrapper file = fsc.getFile(hostIp, fileName);
		System.out.println(file + "WEBFILESERVICE TRANSFERFILE");
		fsc.sendFile(file, targetIp);
	}
	public ArrayList<String> getFileNames(String ip){
		System.out.println("WebFileService: getFileNamesAndroid()");
		
		FileServiceClient fsc = new FileServiceClient();
		ArrayList<String> fileNames = new ArrayList<String>();
		
		try {
			fileNames = fsc.getFileNames(ip);
		} catch (UnknownHostException e) {e.printStackTrace();
		} catch (IOException e) {e.printStackTrace();
		}

		return fileNames;
	}
}
